namespace ValidationFramework
{
	public class ValidationError
	{
		/// <summary>
		/// Initializes a new instance of the ValidationError class.
		/// </summary>
		public ValidationError(Rule rule, string errorMessage, object attemptedValue, ICachedReflectionInfo descriptor)
		{
			ErrorMessage = errorMessage;
			AttemptedValue = attemptedValue;
			Descriptor = descriptor;
			MemberName = descriptor.Name;
			Rule = rule;
		}


		/// <summary>
		/// Gets the error message for the <see cref="ValidationResult"/>.
		/// </summary>
		public string ErrorMessage
		{
			get;
			private set;
		}

		/// <summary>
		/// Gets the <see cref="Rule"/> that this <see cref="ValidationResult"/> has been generated from.
		/// </summary>
		/// <seealso cref="ValidationFramework.Rule.Validate"/>
		public Rule Rule
		{
			get;
			private set;
		}

		/// <summary>
		/// Gets the invalid member's value
		/// </summary>
		public object AttemptedValue
		{
			get;
			private set;
		}

		/// <summary>
		/// Gets the name of the member this error is for
		/// </summary>
		public string MemberName { get; private set; }

		/// <summary>
		/// Gets the <see cref="IMemberDescriptor"/> that this <see cref="ValidationError"/> was generated for.
		/// </summary>
		public ICachedReflectionInfo Descriptor { get; private set; }

	}
}
